<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <button @click="clickHandler">按钮</button>
      <div>{{o}}</div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
      let vm = new Vue({
        el: '#app',
        data: {
          o: 'object',
          dog: {}
        },
        methods: {
          clickHandler() {
            // this.dog.name = 'Trump'
            // this.dog = { name: 'Trump' }
            // this.$set(this.dog, 'name', 'Trump')
            Vue.set(this.dog, 'name', 'Trump')
            console.log(this)
          }
        }
      })
    </script>
  </body>
</html>
